#ifndef INC_LINE_H
#define INC_LINE_H

#include <ostream>
#include "BaseTypes.h"
#include "Color.h"
#include "Point.h"
/*********************************************/
class Line3D
{
private:
	// Data
	Point3D		A, B;

	// Methods
	inline void drawLineMidpoint() const;		// Draw a line using the midpoint algorithm
	inline void drawLineIncremental() const;	// Draw a line using the incremental algorithm
	
	// Friend functions
	friend std::ostream& operator<<(std::ostream&, const Line3D&);
public:

	// Methods
	fl32 length3D() const;				// Returns the length of the line in 3 coordinates (x,y,z)
	fl32 length2D() const;				// Returns the length of the line in 2 coordinates (x,y)
	void draw() const;				// Draw the line to the framebuffer
	void setColor(const Color&);			// Sets both the points colors
	bool intersection2D(const Line3D&,Point3D&) const;	// Returns the point of intersection between the 2 lines
	Line3D clipLineCohenSutherland2D() const;	// Cohen-Sutherland line clipping algorithm ( after projection )
	void setPoints(const Point3D&, const Point3D&); // Apply new endpoints to the line
	Point3D getPoint(const uint16) const;		// Returns the point corresponding with the index
	void getPoints(Point3D&, Point3D&) const;	// Returns both points

	// Operators
	void operator=(const Line3D&);			// Assignment Operator

	// Constructor & Destructor
	Line3D();					// Constructor
	Line3D(const Point3D&, const Point3D&);		// Constructor with initiating values
	Line3D(const Line3D&);				// Copy Constructor
	~Line3D();					// Destructor
};
/*********************************************/
// Output operators
std::ostream& operator<<(std::ostream&, const Line3D&);

#endif // INC_LINE_H
